<%@ page contentType="text/html" pageEncoding="utf-8" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib prefix="iwebjtracker" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<c-rt:set var="serverManager" value="<%= org.internna.iwebjtracker.spring.mvc.IWebJTrackerModelDecoratorInterceptor.SERVER_MANAGER %>" />
<c-rt:set var="linkClass" value="<%= org.internna.iwebjtracker.model.Interlink.class %>" />
<c-rt:set var="issueClass" value="<%= org.internna.iwebjtracker.model.DefaultIssue.class %>" />
<c-rt:set var="commentClass" value="<%= org.internna.iwebjtracker.model.IssueComment.class %>" />
<c-rt:set var="versionClass" value="<%= org.internna.iwebjtracker.model.DefaultVersion.class %>" />
<c-rt:set var="moduleClass" value="<%= org.internna.iwebjtracker.model.DefaultModule.class %>" />
<c-rt:set var="projectClass" value="<%= org.internna.iwebjtracker.model.DefaultProject.class %>" />
<c-rt:set var="connectionDetailsClass" value="<%= org.internna.iwebjtracker.model.DefaultConnectionDetails.class %>" />

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="${fn:replace(pageContext.response.locale, "_", "-")}">
    <iwebmvc:head title="IWebJTracker" charset="utf-8">
        <iwebmvc:require modules="dijit.Editor,dijit.layout.BorderContainer,dojox.layout.ContentPane,dijit.layout.AccordionContainer,dijit.Tree" />
        <style type="text/css"></style>
    </iwebmvc:head>
    <iwebmvc:body renderGoogleAPIsDelay="-1" renderAjaxLogin="true" askForReloadAfterLogin="false" usePreloadingSplashScreen="true" cssStyle="width:100%;height:100%;overflow:hidden;" createTextPreviewer="true">
        <div style="position:absolute;right:0;z-index:1000">
            <span style="display:inline-block;padding-right:10px">
                <span id="userContainer" style="display:inline-block;">
                    <iwebmvc:message argMessage="ui.welcome" />, <iwebmvc:message argMessage="${sessionScope[sessionUser].name}" altText="${sessionScope[sessionUser].name}" /> -
                    <c:set var="login" value="logoff" />
                    <c:if test='${sessionScope[sessionUser].class.simpleName == "GuestUser"}'>
                        <c:set var="login" value="login" />
                    </c:if>
                    <span>
                        (<a href="javascript:openPopup('loginmainAjaxLogin')" style="text-decoration:none"><iwebmvc:message argMessage="${login}" /></a>
                        <c:if test='${sessionScope[sessionUser].anonymous}'>/ <a href="javascript:openPopup('registrationform')" style="text-decoration:none"><iwebmvc:message argMessage="ui.registration.register" /></a></c:if>)
                    </span>
                </span>
            </span>
            <span style="display:inline-block;padding-right:15px;padding-top:4px">
                <c:if test='${fn:substring(pageContext.response.locale, 0, 2) != "en"}'><img src="<c:url value="/resource.iwebmvc" />?file=/images/en.png" style="height:20px;vertical-align:bottom" <c:if test='${fn:substring(pageContext.response.locale, 0, 2) != "en"}'>onClick="window.location.href='<c:url value="/preferences.iwebmvc" />?locale=en'"</c:if> alt="<iwebmvc:message argMessage="US" />" /></c:if>
                <c:if test='${fn:substring(pageContext.response.locale, 0, 2) != "es"}'><img src="<c:url value="/resource.iwebmvc" />?file=/images/es.png" style="height:20px;vertical-align:bottom;" <c:if test='${fn:substring(pageContext.response.locale, 0, 2) != "es"}'>onClick="window.location.href='<c:url value="/preferences.iwebmvc" />?locale=es'"</c:if> alt="<iwebmvc:message argMessage="ES" />" /></c:if>
            </span>
        </div>
        <div id="mainTabContainer" style="width:100%;height:100%;overflow:hidden;" dojoType="dijit.layout.TabContainer">
            <iwebmvc:hide requiredRoles="ROLE_ADMINISTRATOR">
                <div dojoType="dijit.layout.ContentPane" title="<iwebmvc:message argMessage="ui.main.administration" />">
                    <jsp:include page="main/administration/index.jsp" />
                </div>
            </iwebmvc:hide>
            <div dojoType="dijit.layout.ContentPane" title="<iwebmvc:message argMessage="ui.main.dashboard" />">
                <jsp:include page="main/dashboard/index.jsp" />
            </div>
            <iwebmvc:hide requiredRoles="ROLE_USER">
                <div dojoType="dijit.layout.ContentPane" selected="true" title="<iwebmvc:message argMessage="ui.main.myprojects" />">
                    <jsp:include page="main/myprojects/index.jsp" />
                </div>
            </iwebmvc:hide>
        </div>
        <c:if test='${sessionScope[sessionUser].anonymous}'>
            <iwebmvc:popup title="ui.registration.register" id="registrationform" onShow='clearRegistrationForm();'>
                <iwebjtracker:register />
            </iwebmvc:popup>
        </c:if>
        <iwebmvc:hide requiredRoles="ROLE_DEVELOPER">
            <iwebmvc:popup title="ui.issue.link" id="linkIssuesForm">
                <iwebjtracker:linkissue issueClass="${issueClass}" linkClass="${linkClass}" />
            </iwebmvc:popup>
            <iwebmvc:popup title="ui.issue.resolve" id="closeIssueForm">
                <iwebjtracker:closeissue issueClass="${issueClass}" />
            </iwebmvc:popup>
        </iwebmvc:hide>
        <iwebmvc:hide requiredRoles="ROLE_USER">
            <iwebmvc:popup title="ui.profile.edit" id="editprofileform" onShow='clearProfileForm();'>
                <iwebjtracker:editprofile />
            </iwebmvc:popup>
            <iwebmvc:popup title="ui.issues.new" id="newissueform">
                <iwebjtracker:newissue issueClass="${issueClass}" projectClass="${projectClass}" moduleClass="${moduleClass}" versionClass="${versionClass}" />
            </iwebmvc:popup>
            <iwebmvc:popup title="ui.issue.actions.user.comment" id="newcommentform">
                <iwebjtracker:comment issueClass="${issueClass}" commentClass="${commentClass}" />
            </iwebmvc:popup>
            <iwebmvc:popup title="ui.issue.actions.user.attachment" id="newattachmentform" onShow="setDOCUMENTData({path: 'attachments_newdoc'}, null);">
                <iwebjtracker:attachment issueClass="${issueClass}" />
            </iwebmvc:popup>
        </iwebmvc:hide>
        <iwebmvc:hide requiredRoles="ROLE_PROJECT_MANAGER">
            <iwebmvc:popup title="ui.newproject.wizard" id="newprojectform">
                <div style="width:920px">
                    <iwebjtracker:newproject newprojectid="nproject" projectClass="${projectClass}" connectionDetailsClass="${connectionDetailsClass}" serverManager='${requestScope[serverManager]}' />
                </div>
            </iwebmvc:popup>
            <iwebmvc:popup title="org.internna.iwebjtracker.sonar.model.SonarConfiguration" id="sonarform">
                <iwebjtracker:configure projectClass="${projectClass}" />
            </iwebmvc:popup>
            <iwebmvc:popup title="org.internna.iwebjtracker.hudson.model.HudsonConfiguration" id="hudsonform">
                <iwebjtracker:hudson projectClass="${projectClass}" />
            </iwebmvc:popup>
        </iwebmvc:hide>
        <iwebmvc:popup title="ui.project.changelog.selector" id="changelog" onShow="var tree = dijit.byId(dojo.byId('changelogTree').value);tree.resize();tree.focusNode(tree.rootNode.getChildren()[0]);" onHide="placebackChangelogSelector()">
            <iwebjtracker:changelog />
        </iwebmvc:popup>
        <iwebmvc:hide requiredRoles="ROLE_PROJECT_MANAGER">
            <iwebmvc:popup title="ui.issue.actions.administrator.target.selector" id="targetversion" onShow="var tree = dijit.byId(dojo.byId('targetVersionTree').value);tree.resize();tree.focusNode(tree.rootNode.getChildren()[0]);" onHide="placebackTargetVersionSelector()">
                <iwebjtracker:targetversion issueClass="${issueClass}" versionClass="${versionClass}" />
            </iwebmvc:popup>
        </iwebmvc:hide>
    </iwebmvc:body>
</html>